package org.lwd.datalink.writer.rdbms;

import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
import lombok.extern.slf4j.Slf4j;
import org.lwd.datalink.domain.enent.bi.RdbmsCountEvent;
import org.lwd.datalink.event.EventBusFactory;
import org.lwd.datalink.domain.plugin.PluginListener;
import org.lwd.datalink.writer.rdbms.operator.RdbmsOperatorUtil;

/**
 * @author lwd
 */
@Slf4j
public class RdbmsTaskWriterListener implements PluginListener {
    @Override
    public void init() {

        EventBus eventBus = EventBusFactory.getEventBus();

        //获取所有执行count操作
        eventBus.register(new Object() {
            @Subscribe
            public void listener(RdbmsCountEvent event) {
                log.debug(event.toString());
                RdbmsOperatorUtil.count(event);
            }
        });

    }
}
